home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DATATYPE.SWG / 0026_Encryption Theory.pas < prev    next >
Pascal/Delphi Source File  |  1995-03-03  |  8KB  |  142 lines

  1. {
  2. > I'm trying to come up with a registration keying routine for my
  3. > software, but am at kind of a loss on how to do it and make it somewhat
  4. > secure or a pain to crack.
  5. > Here's a program that supposedly uses RSA encryption, but it must be for
  6. > an older pascal because I couldn't get it to compile with version 7.0
  7. > since it tries to use a declaration of Integer[36]. I tried it with
  8. > just a regular Integer declaration and I couldn't get it to work (I
  9. > think).
  10.  
  11.  OKay...  As I recall, that Integer[36] thingy was implemented on DEC
  12.  VMS systems (possibly others) as kind of a work around for, faster than
  13.  real, large (greater than maxint) integer math applications.  You might
  14.  try declaring the variables as longint to test out the algorithm..
  15.  It's 32 bit, but then it may be a hair too small even for the math
  16.  tricks that your rsa is doing...  Making such large numbers that it
  17.  needs 36 bit integers to avoid overflows..
  18.  
  19.    Anyway.  I was really wondering why you didn't want to implement an
  20.  XOR type of encryption method..  It's really so much faster than any
  21.  math trick type of implementation...As there is really no math
  22.  involved..
  23.  
  24.  Encryption security has three basic concerns:
  25.  
  26.  It has to be secure when the enemy knows or has in possesion the method
  27.  that you encrypted your target,
  28.  It has to be secure when the enemy has in his possesion, your target,
  29.  And it has to be secure if the enemy has in possesion, your method,
  30.  your target and your key.
  31.  
  32.  Whatever the method you use, all you are really doing is changing the
  33.  value of a byte (the simplest item) to some other value.  Or you are
  34.  restructuring the method of access.
  35.  
  36.    Or in plain english, you compress your file, then mess it up with
  37.  some encryption algorithm that uses a key to decrypt it.
  38.  How you compress, and how you encrypt doesn't really matter.
  39.  
  40.    What matters, is the possible number of ways that you COULD have
  41.  used.  If that number (of ways) is computable, then your encryption
  42.  method is crackable.
  43.  
  44.    This number (of possible methods) is called the domain of solutions.
  45.  If the domain of solutions can be written into a program then any
  46.  method and combinations of methods is crackable.
  47.  
  48.    To be uncrackable, the domain of solutions must be uncomputable.
  49.  Actually, it may very well BE crackable, but so long as it is
  50.  uncomputable, the cracker has no way to determine where to begin
  51.  cracking!  Thus the defence or security lies not in remaining
  52.  uncrackable, but in remaining encrypted.  Making it take too long to
  53.  crack.  In other words just how much time will it take to solve the
  54.  puzzle and for how long does the puzzle have to remain unsolved before
  55.  it is no longer relevant.
  56.  
  57.    The perfect encryption engine, would be something that has too vast
  58.  of a number of methods to be computable, yet very simple to operate and
  59.  use.  The answer to this seemingly paradoxical question is simple.  You
  60.  have to introduce a non machine element into the engine.  The human
  61.  element.  A human determined key sequence.  In other words, your key is
  62.  defined not by position or elements, but in steps.  Or instructions on
  63.  what to do that is not machine or engine readable.  Or in other words,
  64.  it can't be automatic (one step) and secure.
  65.  
  66.  There are many methods, including weird math methods.  However, it has
  67.  been shown that ALL weird math methods are no more secure than simply
  68.  adding 1 to the value of any byte.  The proof of this was published in
  69.  a mathamatical journal some years ago, sorry, I don't remember what it
  70.  was..  But it basicly stated that any weird math method could be broken
  71.  by a simple brute force program that shifted the values of varying
  72.  lengths of bits of a small portion of the target until it found
  73.  recognizable text or data.
  74.  
  75.  Practical concerns:
  76.    You want a Keyed registration system.  You want to be able to send
  77.  the registered user a post card with some instructions on it on how to
  78.  make his program registered.  This instruction card must be unique to
  79.  his copy of the program.  I assume that the unregistered version of the
  80.  program will be massively distributed I.E. Shareware concept.  Simple.
  81.  You have two maybe three steps involved.
  82.  1 :  A uniqueness must be made in the program, something that
  83.  identifies and connects that particular copy of the program to that
  84.  particular registered user.  A name...
  85.  2:  You need some method of securing the program to that particular
  86.  registered user.  A number or code that interacts with the name to
  87.  produce a file, or key that must then be present during operation for
  88.  the program to work in the registered mode.
  89.  3:  The program must be made aware that it has been registered and if
  90.  the registration code is found to be missing, it will revert to an
  91.  unregistered mode.
  92.  
  93.     What may happen: If the name and code is given out or stolen,
  94.  it must not work with any other copy of the software.   This is the
  95.  most difficult effect to produce and is not possible to implement
  96.  without your direct involvement in the proccess.  Don't expect to be
  97.  able to produce this effect without direct involvment.   In effect, you
  98.  have to make a unique modification to the program unknown to the user.
  99.  
  100.  I once worked on a project that had to be totally secured in this
  101.  manner.  The software had to be registered not only to a specific
  102.  individual or company, but also had to be registered to a single
  103.  machine.  We had to be absolutely sure that there were not multiple
  104.  copies of the software executing on different machines, or indeed on
  105.  the same machine or that there were multiple copies of the software
  106.  that could be installed/deinstalled on the same machine.  It was a
  107.  financial system and the possibility of using it to produce multiple
  108.  books existed which we had to avoid at all costs.  It took a while but
  109.  we solved the problem, unfortunately the software was never produced or
  110.  used, as the company I created this system for went belly up before the
  111.  project was installed and the project was cancelled.
  112.  
  113.    What we used was a regestration key file, that was modified by the
  114.  software, so that it couldn't be used again, it couldn't be used by any
  115.  other copy of the program.  However, if something adverse happened, the
  116.  program knew that it was modified and the same copy of the software
  117.  (that had been origionally registered) could use the key again.  Also,
  118.  the key was time stamped, it was only good for a certain range of
  119.  dates, it couldn't be used to register a copy of the program outside a
  120.  3 day limit.   Also, the software wouldn't operate, even if it was
  121.  registered, if it detected that the date was 30 days since it last
  122.  operated.  It had to be in continuous use at least every 29 days for it
  123.  to remain registered.  Remember that this was a financial package, and
  124.  it had to remain updated to be relevant.  We also had planned to link
  125.  to and download it's data every 30 days and provide a new key to
  126.  operate for the next  30 days.  Thus if the software was installed, and
  127.  the phone lines went down, or we went out of business, the software
  128.  would refuse to operate ( in fact it would self destruct and encrypt
  129.  all work in progress) after 30 days of no contact with home office.
  130.  Also note that at no time did the end user ever have the key file
  131.  before the program saw it first and got a chance to modify it.  Once
  132.  that happened, it couldn't be used by some other copy.  Also, we
  133.  planned on not telling the end users that the software would only work
  134.  on one machine ( the machine it was installed on) We wanted them to
  135.  attempt to pirate the software..
  136.  Why?
  137.    So that we could test their honesty as partners in the business...
  138.  
  139.    I suppose that this was somewhat mercenary on our part, but then, I
  140.  didn't make those kinds of decisions, I just wrote the software....
  141. }
  142.